<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script type="text/javascript">
description("Checks whether unpaired surrogates are replaced with U+FFFD.");

window.jsTestIsAsync = true;

var ws = new WebSocket("ws://localhost:8880/echo");
var message;

ws.onopen = function()
{
    debug("Connected.");
    ws.send("\uD807");
};

ws.onmessage = function (event)
{
    message = event.data;
    shouldBe("message", "'\uFFFD'");
    ws.close();
};

ws.onclose = function()
{
    finishJSTest();
};

</script>
</body>
</html>
